﻿using UnityEngine;
using System.Collections;
using System.IO;

class FrameRange
{
	public int startFrame;
	public int endFrame;
	
	public FrameRange(string frameRange)
	{
		char []seperators = {'-'};
		string []frames = frameRange.Split(seperators);
		startFrame = System.Convert.ToInt32(frames[0]);
		endFrame = System.Convert.ToInt32(frames[1]);
	}
}

public class AnimationMgr : MonoBehaviour {
	Hashtable animTable = new Hashtable();
	string path = "AnimDef.log";
	char[] delimiterChars = {' ', ':'};
	// Use this for initialization
	void Start () {
		Parse();
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	public void Play(string anim){
		
	}
	
	private void Parse(){
		using(StreamReader sr = new StreamReader(path))
		{
			while(sr.Peek() >= 0)
			{
				string line = sr.ReadLine();
				string []words = line.Split(delimiterChars,System.StringSplitOptions.RemoveEmptyEntries);
				string anim = words[0];
				FrameRange frameRange = new FrameRange(words[1]);
				Debug.Log(anim + ":"+ frameRange.startFrame + "-" + frameRange.endFrame);
				animTable.Add(anim, frameRange);
			}
		}
	}
}
